{% if not repository.can_install %}
{% include 'modal/wrong_ha_version.html' with context %}
{% endif %}

<div class="card-action">
  {% if repository.can_install %}
  <form action="/hacsapi/{{ hacs.token }}/repository_install" name="install" method="post" accept-charset="utf-8"
    enctype="application/x-www-form-urlencoded" class="hacs-form">
    <input type="hidden" name="repository_id" value="{{repository.information.uid}}">
    <a class="actionlink" href="#" onclick="toggleLoading();document.getElementsByName('install')[0].submit()">
      {{repository.main_action}}
    </a>
  </form>
  {% else %}
  <a class="modal-trigger actionlink" href="#haversion">
    {{repository.main_action}}
  </a>
  {% endif %}

  {% if repository.pending_upgrade and repository.display_version_or_commit == "version" %}
  <a class="actionlink" rel='noreferrer'
    href='https://github.com/{{repository.information.full_name}}/releases/{{repository.available_version}}'
    target='_blank'>
    CHANGELOG
  </a>
  {% endif %}

  <a class="actionlink" rel='noreferrer' href='https://github.com/{{repository.information.full_name}}' target='_blank'>
    repository
  </a>

  {% if repository.status.installed and repository.information.category == "plugin" %}
  {% set name =  repository.information.full_name.split("/")[-1] %}
  <a class="actionlink" href='/community_plugin/{{name}}/{{repository.information.file_name}}' target='_blank'>
    OPEN PLUGIN
  </a>
  {% endif %}

  {% if repository.status.installed and repository.information.uid != "172733314"  %}
  <form action="/hacsapi/{{ hacs.token }}/repository_uninstall" name="uninstall" method="post" accept-charset="utf-8"
    enctype="application/x-www-form-urlencoded" class="hacs-form">
    <input type="hidden" name="repository_id" value="{{repository.information.uid}}">
    <a class="actionlink uninstall" href='#'
      onclick="toggleLoading();document.getElementsByName('uninstall')[0].submit()">
      UNINSTALL
    </a>
  </form>
  {% endif %}

</div>